<template>
	<view class="content">
		<!-- 搜索 -->
		<view class="search">
			<view class="search-content">
				<view class="search-input"> <input type="text" v-model='form.key' placeholder="请输入商品关键词"></view>
				 <view class="determine" @click="search">确定</view>
			</view>
		</view>
		<!-- 搜索end -->
		<!-- 商品列表 -->
	<!-- 	<view class="shop-list">
			<view class="shop-item-box">
				<view class="s-i-title">店铺街</view>
				<view class="s-red-bg">
					<view class="shop-box">
						<view class="shop-heder-bg">
							<view class="s-red-item">
								<view class="s-red-circle"></view>
								<view class="s-red-title">Sesssggdffd</view>
							</view>
							<view class="s-red-subTitle"> 萨达萨达萨达撒旦</view>
							<view class="shop-img-list">
								<view class="shop-img-item">
									<image src="../../static/test.png" mode="aspectFill"></image>
								</view>
								<view class="shop-img-item">
									<image src="../../static/test.png" mode="aspectFill"></image>
								</view>
								<view class="shop-img-item">
									<image src="../../static/test.png" mode="aspectFill"></image>
								</view>
							</view>
						</view>

					</view>
					<view class="shop-box">
						<view class="shop-heder-bg">
							<view class="s-red-item">
								<view class="s-red-circle"></view>
								<view class="s-red-title">Sesssggdffd</view>
							</view>
							<view class="s-red-subTitle"> 萨达萨达萨达撒旦</view>
							<view class="shop-img-list">
								<view class="shop-img-item">
									<image src="../../static/test.png" mode="aspectFill"></image>
								</view>
								<view class="shop-img-item">
									<image src="../../static/test.png" mode="aspectFill"></image>
								</view>
								<view class="shop-img-item">
									<image src="../../static/test.png" mode="aspectFill"></image>
								</view>
							</view>
						</view>

					</view>
				</view>
			</view>

		</view> -->
		<!-- 商品列表 end-->

		<!-- 猜你喜欢-->
		<view class="guess-list">
			<view class="g-l-box" v-for="(item,index) in list" @click="go(item)">
				<image :src="item.cover" mode="aspectFill"></image>
				<view class="g-l-item">
					<view class="g-l-title">
						<view class="g-l-bq">自营</view>{{item.name}}
					</view>
					<view class="g-l-price">￥{{item.price}}</view>
				</view>
			</view>



		</view>
		<!-- 猜你喜欢end-->
	<footerNav @change_nav="change_nav"></footerNav>
	</view>
</template>

<script>
	import footerNav from "@/components/footer/footer_nav.vue"
	
	import api from '@/api/index.js'
	export default {
		data() {
			return {
				list: [],
				form:{
					key:'',
				},
				
			}
		},
		components: {
			footerNav
		},
		mounted() {
			this.getDate();
		},
		methods: {
			search(){
				this.getDate();
			},
			go(item){
				console.log(item.id)
				uni.navigateTo({
					url: '/pages/shop/details?id='+item.id
				})
			},
			//底部切换
			change_nav(index){
				if(index==0){
					uni.navigateTo({
						url: '/pages/shop/index'
					})
				}
				if(index==1){
					uni.navigateTo({
						url: '/pages/shop/classification'
					})
				}
				if(index==2){
					uni.navigateTo({
						url: '/pages/shop/index'
					})
				}
				if(index==3){
					uni.navigateTo({
						url: '/pages/index/channel/index'
					})
				}
				if(index==4){
					uni.navigateTo({
						url: '/pages/index/user/index'
					})
				}
				this.$store.commit("change_page", index)
			},
			//获取数据
			getDate() {
				api.getshop(this.form).then((res) => {
					console.log(res.data);
					if (res.data.code == 0) {
						this.list = res.data.data.data;
					
					} else {

					}
				})
			},
		}
	}
</script>

<style>
	@import './index.css';
	.search-content{
		display: flex;
		justify-content: space-between;
		padding-left: 30rpx;
		padding-right: 30rpx;
		box-sizing: border-box;
		align-items: center;
		
	}
	.content {
		padding-top: 100rpx;
	}
	.determine{
		width: 100rpx;
		height: 50rpx;
		/* border: 1px solid #fff; */
		line-height: 50rpx;
		border-radius: 30rpx;
		margin-left: 20rpx;
		
		text-align: center;
		font-size: 24rpx;
		color: #fff;
		/* text-empha; */
	}
</style>
